package operation;

import book.Book;
import book.Booklist;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Hua YY
 * Date: 2024 —03 —04
 * Time: 20:55
 */
public class FindOperation implements IOPeration {
    public void work(Booklist booklist) {
        System.out.println("查找图书");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        int currentSize = booklist.getUsedsize();
        for (int i = 0; i < currentSize; i++) {
            Book book = booklist.getBook(i);
           if (book.getName().equals(name)) {
              System.out.println("找到了这本书");
              System.out.println(book);
              return;
           }
        }
        System.out.println("没有找到这本书");
    }




}

